Yes, but you have to do it correctly. You should use 10 AWG
wire. The splice should be in an approved electric box using the
right size wire nuts. You secure and protect the extended wire and
you should not "bury" the splice box in the wall, but cover it with
an approved cover made for the purpose. If it is a surface mount
box, cover it with a blank metal cover.